**************************************************************************************************
*Replication for Changing Horses in Midstream: Leadership Changes and the Civil War Peace Process*
**************************************************************************************************


**************************
* Civil War Negotiations *
**************************
sort dyadid year	

*insider/outsider change
logit negotiations L.insideronly L.mediation rebstrength2 terrcont polity2 milpers_ipop lnseverity lnduration3 secession activedyads lnpop negyears* if coup == 0, r cluster(dyadid)
estimates store m1
logit negotiations L.outsiderv2 L.mediation rebstrength2 terrcont polity2 milpers_ipop lnseverity lnduration3 secession activedyads lnpop  negyears* if coup == 0, r cluster(dyadid)
estimates store m2

*SLOS Leader Changes Data 
	**SLOS == outsider
logit negotiations L.nonsolsch L.mediation rebstrength2 terrcont polity2 milpers_ipop lnseverity lnduration3 secession activedyads lnpop  negyears* if coup == 0, r cluster(dyadid)
estimates store m3
logit negotiations L.solschdum L.mediation rebstrength2 terrcont polity2 milpers_ipop lnseverity lnduration3 secession activedyads lnpop  negyears* if coup == 0, r cluster(dyadid)
estimates store m4

estout m1 m2 m3 m4, cells(b (star fmt(%9.3f)) p(par)) stats(N  ll chi2, star fmt(%9.3f %9.0g)) style(tex)


************************
* Civil War Settlments *
************************
stset duration3, id(dyadep3) failure(outcome_st3==3)

*insider/outsider change
stcrreg insideronly mediation rebstrength2 terrcont polity2 milpers_ipop lnseverity secession activedyads lnpop if coup == 0 & totaldeaths3 > 199, r cluster(dyadid) compete(outcome_st3 = 1,2,4,5) texp(ln(_t)) tvc(lnpop)
estimates store m1
stcrreg outsiderv2 mediation rebstrength2 terrcont polity2 milpers_ipop lnseverity secession activedyads lnpop if coup == 0 & totaldeaths3 > 199, r cluster(dyadid) compete(outcome_st3 = 1,2,4,5) texp(ln(_t)) tvc(lnpop)
estimates store m2

*SLOS Leader Changes Data 
	**SLOS == outsider
stcrreg nonsolsch mediation rebstrength2 terrcont polity2 milpers_ipop lnseverity secession activedyads lnpop if coup == 0 & totaldeaths3 > 199, r cluster(dyadid) compete(outcome_st3 = 1,2,4,5) texp(ln(_t)) tvc(lnpop)
estimates store m3
stcrreg solschdum mediation rebstrength2 terrcont polity2 milpers_ipop lnseverity secession activedyads lnpop if coup == 0 & totaldeaths3 > 199, r cluster(dyadid) compete(outcome_st3 = 1,2,4,5) texp(ln(_t)) tvc(lnpop)
estimates store m4

estout m1 m2 m3 m4, cells(b (star fmt(%9.3f)) p(par)) stats(N N_sub N_fail chi2 ll , star fmt(%9.3f %9.0g)) eform style(tex)
